home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase v5.5 / SAMPLES2.PAK / EQUIPMNT.WFM < prev    next >
Encoding:
Text File  |  1995-07-18  |  6.8 KB  |  249 lines

  1. ******************************************************************************
  2. *  PROGRAM:      Equipmnt.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         5/93
  7. *
  8. *  UPDATED:      5/95
  9. *
  10. *  REVISION:     $Revision:   1.58  $
  11. *
  12. *  VERSION:      Visual dBASE
  13. *
  14. *  DESCRIPTION:  This program allows changing equipment for the AirBorland
  15. *                airlines -- it uses a main display form (defined here), and
  16. *                other dialog forms (changeq.wfm, getflts.wfm) for obtaining
  17. *                information for its display.
  18. *
  19. *  PARAMETERS:   None
  20. *
  21. *  CALLS:        Equipmnt.mnu   (Menu for this form)
  22. *                Changeq.wfm    (Form for changing equipment)
  23. *                Equipmnt.qbe   (View of tables)
  24. *                Buttons.cc     (Custom Controls file)
  25. *
  26. *  USAGE:        DO Equipmnt.wfm
  27. *
  28. *******************************************************************************
  29. create session
  30. set talk off
  31. set ldCheck off
  32.  
  33.  
  34. ** END HEADER -- do not remove this line*
  35. * Generated on 07/06/95
  36. *
  37. parameter bModal
  38. local f
  39. f = new EQUIPMNTFORM()
  40. if (bModal)
  41.    f.mdi = .F. && ensure not MDI
  42.    f.ReadModal()
  43. else
  44.    f.Open()
  45. endif
  46. CLASS EQUIPMNTFORM OF FORM
  47.    Set Procedure To &_dbwinhome.samples\BUTTONS.CC additive
  48.    this.OnOpen = CLASS::ONOPEN
  49.    this.OnClose = CLASS::ONCLOSE
  50.    this.Height = 21.1758
  51.    this.MenuFile = "EQUIPMNT.MNU"
  52.    this.Minimize = .F.
  53.    this.MousePointer = 1
  54.    this.ColorNormal = "N/GB+"
  55.    this.Maximize = .F.
  56.    this.Text = "Flight Equipment Management"
  57.    this.Width = 72
  58.    this.View = "EQUIPMNT.QBE"
  59.    this.Top = 0
  60.    this.MDI = .F.
  61.    this.Left = 13.5
  62.  
  63.    DEFINE IMAGE LOGOIMAGE OF THIS;
  64.        PROPERTY;
  65.          Height 7.5293,;
  66.          Width 71.6738,;
  67.          DataSource "FILENAME AIRBRLND.BMP",;
  68.          Alignment 2,;
  69.          Left 0.6592
  70.  
  71.    DEFINE TEXT TITLE OF THIS;
  72.        PROPERTY;
  73.          Height 1.4131,;
  74.          ColorNormal "B/GB+",;
  75.          Text "Flight Information",;
  76.          Width 80.332,;
  77.          Top 7.4688,;
  78.          Alignment 1,;
  79.          FontSize 14,;
  80.          Left -1.832
  81.  
  82.    DEFINE BROWSE FLIGHTSBROWSE OF THIS;
  83.        PROPERTY;
  84.          Height 4.1191,;
  85.          Modify .F.,;
  86.          CUATab .T.,;
  87.          ColorNormal "N/W",;
  88.          Fields "FLIGHTS->FLIGHT_NO\H='FLIGHT NO'\12,FLIGHTS->ORIGIN\8,FLIGHTS->DEST\H='DESTINATION'\14,FLIGHTS->PRICE\12,FLIGHTS->DATE\12,FLIGHTS->DEPARTURE\12,FLIGHTS->ARRIVAL\16",;
  89.          Width 70.5,;
  90.          ShowRecNo .F.,;
  91.          Alias "Flights",;
  92.          Top 8.9395,;
  93.          Left 1
  94.  
  95.    DEFINE PUSHBUTTON EQUIPBUTTON OF THIS;
  96.        PROPERTY;
  97.          Height 2.7646,;
  98.          ColorNormal "B/W",;
  99.          Text "Change Equipment",;
  100.          Width 21.333,;
  101.          OnClick CLASS::CHANGEEQUIPMNT,;
  102.          Top 14.5879,;
  103.          Default .T.,;
  104.          Group .T.,;
  105.          FontSize 12,;
  106.          Left 50
  107.  
  108.    DEFINE ENTRYFIELD PLANEENTRY OF THIS;
  109.        PROPERTY;
  110.          Height 1.1309,;
  111.          ColorNormal "B/GB+",;
  112.          Width 19.833,;
  113.          Top 13.3984,;
  114.          DataLink "AIRCRDB->AIRCRAFT",;
  115.          Border .F.,;
  116.          Enabled .F.,;
  117.          FontSize 12,;
  118.          Left 1
  119.  
  120.    DEFINE IMAGE PLANEIMAGE OF THIS;
  121.        PROPERTY;
  122.          Height 6.2354,;
  123.          Width 47,;
  124.          Top 14.5879,;
  125.          DataSource "BINARY AIRCRDB->IMAGE",;
  126.          Alignment 1,;
  127.          Left 1
  128.  
  129.    DEFINE SAMPLEINFOBUTTON EQUIPMNTINFOBUTTON OF THIS;
  130.        PROPERTY;
  131.          Height 1.1768,;
  132.          Width 3.5,;
  133.          Top 19.7051,;
  134.          Group .T.,;
  135.          Left 68
  136.  
  137.    procedure OnOpen
  138.    *******************************************************************************
  139.    private fld
  140.  
  141.    set exact off
  142.    set fields to
  143.    set fields off
  144.    shell(.F.)
  145.  
  146.    *** Create arrays for use in GetFlts.wfm in order to bring it up faster
  147.  
  148.    public originAr, destAr
  149.    local curRecCnt
  150.    private fld, tagName
  151.  
  152.    *** Make array of unique origins
  153.    use flights in select() alias temp
  154.    select temp
  155.    tagName = field(2) + "UN"
  156.    set order to &tagName                   && Origin unique tag
  157.    count to curRecCnt                      && For declaring array
  158.    declare originAr[curRecCnt,1]
  159.    fld = field(2)                          && Origin field
  160.    copy to array originAr field &fld
  161.  
  162.    *** Make array of unique destinations
  163.    tagName = field(3) + "UN"
  164.    set order to &tagName                   && Destination unique tag
  165.    count to curRecCnt                      && For declaring array
  166.    declare destAr[curRecCnt,1]
  167.    fld = field(3)                          && Dest field
  168.    copy to array destAr field &fld
  169.    use
  170.  
  171.    select flights                          && Return to original workarea
  172.    form.equipmntInfoButton.sampleName = "Equipmnt.wfm"
  173.  
  174.  
  175.    *******************************************************************************
  176.  
  177.    procedure OnClose
  178.    *******************************************************************************
  179.  
  180.    release originAr, destAr
  181.    shell(.T.)
  182.  
  183.  
  184.  
  185.    *******************************************************************************
  186.  
  187.    procedure ChangeEquipmnt
  188.  
  189.    * Change plane for currently selected flight
  190.    *******************************************************************************
  191.    local curAircraft, newAircraft
  192.  
  193.    curAircraft = flights->aircraft        && Save current aircraft
  194.    newAircraft = CLASS::CallChangeEqForm(curAircraft)
  195.    if curAircraft <> newAircraft          && Only change table with new aircraft
  196.       replace flights->aircraft with newAircraft
  197.       refresh
  198.    endif
  199.  
  200.  
  201.    *******************************************************************************
  202.  
  203.    function CallChangeEqForm(curAircraft)
  204.  
  205.    * Open modally form ChangeEq, which allows changing the plane currently used.
  206.    * ChangeEq.wfm has a listbox of plane names, and an image of the name currently
  207.    * highlighted in the listbox.  The image is defined on a binary field of
  208.    * Aircrdb.dbf, and the listbox is defined on its name field, so the image
  209.    * changes as you move through the listbox.
  210.    *******************************************************************************
  211.    local changeEqForm, childRec, retVal
  212.  
  213.    childRec = recno("aircrdb")            && This is for highlighting current
  214.    set procedure to &_dbwinhome.samples\Changeq.wfm additive
  215.                                           && plane in the Changeq form's listbox
  216.    create session
  217.    set talk off
  218.  
  219.    changEqForm = new ChangEqForm()
  220.    changEqForm.mdi = .F.
  221.    changEqForm.value = curAircraft
  222.    changEqForm.childRec = childRec
  223.    changEqForm.Readmodal()
  224.  
  225.    retVal = changEqForm.value
  226.    changEqForm.Release()
  227.    close procedure &_dbwinhome.samples\Changeq.wfm
  228.  
  229.    return retVal                          && Return the new airplane
  230.  
  231.  
  232. ENDCLASS
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.